﻿using DG.Tweening;
using System;

namespace ZyGame
{

    public sealed class UIOptions : Attribute
    {
        internal string name;
        internal string path;
        internal int layer;
        internal Ease _opened = Ease.INTERNAL_Zero;
        internal Ease _closed = Ease.INTERNAL_Zero;
        public UIOptions(string path, int layer)
        {
            if (path.EndsWith(".prefab") is false)
            {
                path += ".prefab";
            }
            if (AppConfig.instance.gameOptions.packageRoot.IsNullOrEmpty() is false)
            {
                if (path.StartsWith("Resources") is false && path.StartsWith("Assets") is false)
                {
                    if (path.StartsWith(AppConfig.instance.gameOptions.packageRoot) is false)
                    {
                        path = AppConfig.instance.gameOptions.packageRoot + "/" + path;
                    }
                }
            }
            this.path = path;
            this.layer = layer;
            this.name = path;
        }

        public UIOptions(string path, UIDepth layer) : this(path, (int)layer)
        {

        }

        public UIOptions(string path, UIDepth depth, Ease opened) : this(path, depth)
        {
            _opened = opened;
        }

        public UIOptions(string path, UIDepth depth, Ease opened, Ease closed) : this(path, depth)
        {
            _opened = opened;
            _closed = closed;
        }

        public enum UIDepth
        {
            Low = 0,
            Middle = 1,
            Top = 2,
            Waiting = 997,
            MsgBox = 998,
            Toast = 999
        }
    }
}
